package ibm.cognos.imt.template

import groovy.xml.MarkupBuilder

/**
 * Created with IntelliJ IDEA.
 * User: eric
 * Date: 5/12/14
 * Time: 10:39 AM
 * To change this template use File | Settings | File Templates.
 */
class QueriesTemplate extends AbstractTemplate{
    def queryMap
    def filterList

    QueriesTemplate(map, filters) {
        queryMap = map
        filterList = filters
    }

    @Override
    def generateTemplateSpec(MarkupBuilder builder) {
        builder.queries{

        }
    }

    @Override
    def getTemplateNode() {
        root = new XmlSlurper().parseText(getSpecStr())
        queryMap.each{ k,v ->
            root.appendNode(new QueryTemplate(v, filterList).getTemplateNode())
        }

        root
    }
}
